// 递推 时间复杂度 O(rowIndex * rowIndex) 空间复杂度 O(1)

class Solution {
public:
    vector<int> getRow(int rowIndex) {
        vector<int> ret(rowIndex + 1);
        for (int i = 0; i <= rowIndex; i++) {
            ret[0] = ret[i] = 1;
            for (int j = i - 1; j > 0; j--) {
                ret[j] = ret[j] + ret[j - 1];
            }
        }
        return ret;
    }
};